package com.kaifamiao.ioc.collections.test;

import com.kaifamiao.ioc.collections.Person;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.time.LocalDate;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;

public class InjectionTest1 {

    public static void main(String[] args) {

        String configLocations = "classpath*:com/**/injection.xml";
        // 创建容器
        AbstractApplicationContext container = new ClassPathXmlApplicationContext( configLocations );

        Person p = container.getBean( "first", Person.class );
        System.out.println( p.getName() );
        // 获得Set集合
        Set<String> names = p.getChildhoodNames();
        System.out.println( names );

        // 获得List集合
        List<String> hobbies = p.getHobbies();
        System.out.println( hobbies );

        // 获得Map集合
        Map<String, LocalDate> luckDays = p.getLuckDays();
        System.out.println( luckDays );

        // 获得Properties集合
        Properties address = p.getAddress();
        System.out.println( address );

        container.close();
    }
}
